package com.ruoyi.web.controller.admin;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.dto.XsItemDataDto;
import com.ruoyi.system.service.IXsDataService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * xs_data 写手数据表Controller
 */
@RestController
@RequestMapping("/system/data")
public class XsDataController extends BaseController {

    @Autowired
    private IXsDataService xsDataService;


    /**
     * 查询订单列表
     */
    @GetMapping("/list")
    public TableDataInfo appList(XsItemDataDto itemDataDto) {
        startPage();
        return getDataTable(xsDataService.selectDataList(itemDataDto));
    }

    /**
     * 新增
     * @param itemDataDto
     * @return
     */
    @PostMapping()
    public AjaxResult add(XsItemDataDto itemDataDto) {
        return toAjax(xsDataService.add(itemDataDto));
    }

    /**
     * 批量导入数据
     * @param file
     * @return
     */
    @ApiOperation(value = "批量导入数据")
    @PostMapping("/batchImportClue")
    public AjaxResult batchImportClue(MultipartFile file) {
        xsDataService.batchImportDataClue(file);
        return success();
    }


}